<pre class="docs-method-signature"><code>graph.fromJSON(jsonObject, [options])</code></pre>

<p>Load a graph from a JSON object (not string). Used in conjunction with the <code>graph.toJSON()</code> <a href="#dia.Graph.prototype.toJSON">function</a>.</p>

<p>The <code>options</code> object may contain additional data that is passed over to graph change event listeners.</p>

<p>Note that this method does not expect a JSON string but rather an object in the JSON format. Use <code>JSON.parse(jsonString)</code> if you need to convert a JSON string into the object form:</p>

<pre><code>graph.fromJSON(JSON.parse(jsonString));</code></pre>

<p>Example of storing stringified JSON objects:</p>

<pre><code>var jsonString = JSON.stringify(graph.toJSON());
// ... send jsonString to the server
// store jsonString to localStorage or do whatever you want
// later on ...
graph.fromJSON(JSON.parse(jsonString));</code></pre>

<p>Example of storing JSON objects directly:</p>

<pre><code>var jsonObject = graph.toJSON();
// ... send jsonObject to the server
// store jsonObject (e.g. in a non-relational database)
// later on ...
graph.fromJSON(jsonObject)</code></pre>
